﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Infrastructure.WpfClient.Accessibility
{
    public partial class AccessibilitySyncAdapter : Microsoft.Synchronization.Data.Server.SyncAdapter
    {
        partial void OnInitialized();

        public AccessibilitySyncAdapter()
        {
            this.InitializeCommands();
            this.InitializeAdapterProperties();
            this.OnInitialized();
        }
        private void InitializeCommands()
        {
            this.SelectIncrementalInsertsCommand = new System.Data.SqlClient.SqlCommand();
            this.SelectIncrementalInsertsCommand.CommandText = "usp_accssesibility_SelectIncrementalInsertsCommand";
            this.SelectIncrementalInsertsCommand.CommandType = System.Data.CommandType.StoredProcedure;


            this.SelectIncrementalInsertsCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CurrentUserId", System.Data.SqlDbType.UniqueIdentifier));
            this.SelectIncrementalInsertsCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_initialized", System.Data.SqlDbType.Bit));
            this.SelectIncrementalInsertsCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_last_received_anchor", System.Data.SqlDbType.BigInt));
            this.SelectIncrementalInsertsCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_client_id_binary", System.Data.SqlDbType.VarBinary));
            this.SelectIncrementalInsertsCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_new_received_anchor", System.Data.SqlDbType.BigInt));


            this.SelectIncrementalUpdatesCommand = new System.Data.SqlClient.SqlCommand();
            this.SelectIncrementalUpdatesCommand.CommandText = "usp_accssesibility_SelectIncrementalUpdatesCommand";
            this.SelectIncrementalUpdatesCommand.CommandType = System.Data.CommandType.StoredProcedure;
            this.SelectIncrementalUpdatesCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_initialized", System.Data.SqlDbType.Bit));
            this.SelectIncrementalUpdatesCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_last_received_anchor", System.Data.SqlDbType.BigInt));
            this.SelectIncrementalUpdatesCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_new_received_anchor", System.Data.SqlDbType.BigInt));
            this.SelectIncrementalUpdatesCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_client_id_binary", System.Data.SqlDbType.VarBinary));


            this.SelectIncrementalDeletesCommand = new System.Data.SqlClient.SqlCommand();
            this.SelectIncrementalDeletesCommand.CommandText = "usp_accssesibility_SelectIncrementalDeletesCommand";
            this.SelectIncrementalDeletesCommand.CommandType = System.Data.CommandType.StoredProcedure;
            this.SelectIncrementalDeletesCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_initialized", System.Data.SqlDbType.Bit));
            this.SelectIncrementalDeletesCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_last_received_anchor", System.Data.SqlDbType.BigInt));
            this.SelectIncrementalDeletesCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_new_received_anchor", System.Data.SqlDbType.BigInt));
            this.SelectIncrementalDeletesCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_client_id_binary", System.Data.SqlDbType.VarBinary));



            this.InsertCommand = new System.Data.SqlClient.SqlCommand();
            this.InsertCommand.CommandText = "usp_accssesibility_InsertCommand";
            this.InsertCommand.CommandType = System.Data.CommandType.StoredProcedure;
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_client_id_binary", System.Data.SqlDbType.VarBinary));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.UniqueIdentifier));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@application", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@userId", System.Data.SqlDbType.UniqueIdentifier));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@kind", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code1", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code2", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code3", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code4", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code5", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code6", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code7", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code8", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code9", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code10", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code11", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code12", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code13", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code14", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code15", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Value", System.Data.SqlDbType.VarChar));
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@DefaultValue", System.Data.SqlDbType.NVarChar));
            System.Data.SqlClient.SqlParameter insertcommand_sync_row_countParameter = new System.Data.SqlClient.SqlParameter("@sync_row_count", System.Data.SqlDbType.Int);
            insertcommand_sync_row_countParameter.Direction = System.Data.ParameterDirection.Output;
            this.InsertCommand.Parameters.Add(insertcommand_sync_row_countParameter);
            this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_last_received_anchor", System.Data.SqlDbType.BigInt));






            this.DeleteCommand = new System.Data.SqlClient.SqlCommand();
            this.DeleteCommand.CommandText = "usp_accssesibility_DeleteCommand";
            this.DeleteCommand.CommandType = System.Data.CommandType.StoredProcedure;
            this.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_client_id_binary", System.Data.SqlDbType.VarBinary));
            this.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Id", System.Data.SqlDbType.UniqueIdentifier));
            this.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_force_write", System.Data.SqlDbType.Bit));
            this.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_last_received_anchor", System.Data.SqlDbType.BigInt));
            System.Data.SqlClient.SqlParameter deletecommand_sync_row_countParameter = new System.Data.SqlClient.SqlParameter("@sync_row_count", System.Data.SqlDbType.Int);
            deletecommand_sync_row_countParameter.Direction = System.Data.ParameterDirection.Output;
            this.DeleteCommand.Parameters.Add(deletecommand_sync_row_countParameter);

            this.UpdateCommand = new System.Data.SqlClient.SqlCommand();
            this.UpdateCommand.CommandText = "usp_accssesibility_UpdateCommand";
            this.UpdateCommand.CommandType = System.Data.CommandType.StoredProcedure;
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Id", System.Data.SqlDbType.UniqueIdentifier));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@application", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@UserId", System.Data.SqlDbType.UniqueIdentifier));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@kind", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code1", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code2", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code3", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code4", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code5", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code6", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code7", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code8", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code9", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code10", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code11", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code12", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code13", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code14", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Code15", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Value", System.Data.SqlDbType.VarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@DefaultValue", System.Data.SqlDbType.NVarChar));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_force_write", System.Data.SqlDbType.Bit));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_last_received_anchor", System.Data.SqlDbType.BigInt));
            this.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_client_id_binary", System.Data.SqlDbType.VarBinary));
            System.Data.SqlClient.SqlParameter updatecommand_sync_row_countParameter = new System.Data.SqlClient.SqlParameter("@sync_row_count", System.Data.SqlDbType.Int);
            updatecommand_sync_row_countParameter.Direction = System.Data.ParameterDirection.Output;
            this.UpdateCommand.Parameters.Add(updatecommand_sync_row_countParameter);


            this.SelectConflictDeletedRowsCommand = new System.Data.SqlClient.SqlCommand();
            this.SelectConflictDeletedRowsCommand.CommandText = "SELECT CT.[id], CT.SYS_CHANGE_CONTEXT, CT.SYS_CHANGE_VERSION FROM CHANGETABLE(CHA" +
                "NGES dbo.Accessibility, @sync_last_received_anchor) CT WHERE (CT.[id] = @id AND " +
                "CT.SYS_CHANGE_OPERATION = \'D\')";

            this.SelectConflictDeletedRowsCommand.CommandType = System.Data.CommandType.Text;
            this.SelectConflictDeletedRowsCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_last_received_anchor", System.Data.SqlDbType.BigInt));
            this.SelectConflictDeletedRowsCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.UniqueIdentifier));


            this.SelectConflictUpdatedRowsCommand = new System.Data.SqlClient.SqlCommand();
            this.SelectConflictUpdatedRowsCommand.CommandText = @"SELECT dbo.Accessibility.[id], [application], [userid], [kind], [code], [code1], [code2], [code3], [code4], [code5], [code6], [code7], [code8], [code9], [code10], [code11], [code12], [code13], [code14], [code15], [value], [defaultvalue], CT.SYS_CHANGE_CONTEXT, CT.SYS_CHANGE_VERSION FROM dbo.Accessibility JOIN CHANGETABLE(VERSION dbo.Accessibility, ([id]), (@id)) CT  ON CT.[id] = dbo.Accessibility.[id]";
            this.SelectConflictUpdatedRowsCommand.CommandType = System.Data.CommandType.Text;
            this.SelectConflictUpdatedRowsCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.UniqueIdentifier));

            

        }
        private void InitializeAdapterProperties()
        {
            this.TableName = "Accessibility";
        }

    }
}
